<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;
use Captcha;
use Cart;
use Auth;
<<<<<<< HEAD
use Mail;
=======
use User;
use Illuminate\Support\Facades\Redis;
>>>>>>> 88a8c1988ddc05f26426694e098007109eb5a7dd
class TestController extends Controller
{
    
    // public $a = 1;


    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        // return $user = DB::table('goods')->get();
        // dd($uid);
        // echo 1111;
        return view('layouts.test');
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        // return Captcha::src();
        // dd(uid);
        // $a = 1;
        // echo $this->a;
        // $user = Auth::user()->name;
        // dd($user);
<<<<<<< HEAD
=======
        // $user = Cart::count();
        // dd($user);
        // $uid = Auth::user()->id;
        // $count = Cart::instance($uid)->count();
        // dd($count);
        $key = '6';
        $user = Auth::user()->name;
        $user = 'zhang';
        // dd($user);
         if($user){
            //将用户名存储到Redis中
            Redis::set($key,$user);
         }

        //判断指定键是否存在
        if(Redis::exists($key)){
            //根据键名获取键值
            dd(Redis::get($key));
        }
>>>>>>> 88a8c1988ddc05f26426694e098007109eb5a7dd
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }

    public function sendEmailReminder(Request $request, $id)
    {
        $user = User::findOrFail($id);
        Mail::send('emails.reminder', ['user' => $user], function ($m) use ($user) {
            $m->to($user->email, $user->name)->subject('Your Reminder!');
        });
    }
}
